# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=twofi
pkgver=2.0
pkgrel=15
groups=('blackarch' 'blackarch-recon')
pkgdesc='Twitter Words of Interest.'
arch=('any')
url='http://www.digininja.org/projects/twofi.php'
license=('CCPL')
depends=('ruby' 'ruby-bundler' 'ruby-pkg-config' 'libxslt')
source=("http://www.digininja.org/files/${pkgname}_${pkgver}-beta.tar.bz2")
sha512sums=('e1907abe4333fe039aa0fcb2571a9dbe617fd74bea39243d21592a39892d771591b0fb6912602d4ae5a74b4448030782dfe455d9ee7685be34abff4dee5601b4')
install="$pkgname.install"

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 755 "$pkgname.rb" "$pkgdir/usr/share/$pkgname/$pkgname.rb"
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname" "$pkgname.yml" Gemfile
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec bundle exec ./$pkgname.rb "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

